/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package airacrobats.control;

import airacrobats.game.Camera;
import airacrobats.game.object.Airplane;
import airacrobats.io.data.MovementData;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
import javax.vecmath.Point4f;

/**
 * The replay controller is used only to change the camera on the replay. Don't get too excited.
 */
public class ReplayController extends Controller implements KeyListener
{
    /**
     * The camera.
     */
    private Camera camera;

    /**
     * @param airplane The player airplane.
     * @param camera The camera.
     */
    public ReplayController(Airplane airplane, Camera camera)
    {
        super(airplane, new ArrayList<MovementData>());
        this.camera = camera;
    }

    /**
     */
    @Override
    protected int doUpdate(long deltaTime)
    {
        return 0;
    }

    /**
     */
    public void keyPressed(KeyEvent e)
    {
        if (e.getKeyCode() == KeyEvent.VK_8)
        {
            camera.changeCamera(true, true);
        }
        else if (e.getKeyCode() == KeyEvent.VK_9)
        {
            camera.changeCamera(false, true);
            camera.setVisionStructure(new Point4f(-5.0f, 2.0f, 0.0f, 0));
        }
        else if (e.getKeyCode() == KeyEvent.VK_NUMPAD6)
        {
            camera.getVisionStructure().z -= 0.01f;
        }
        else if (e.getKeyCode() == KeyEvent.VK_NUMPAD4)
        {
            camera.getVisionStructure().z += 0.01f;
        }
        else if (e.getKeyCode() == KeyEvent.VK_NUMPAD8)
        {
            camera.getVisionStructure().x += 0.01f;
        }
        else if (e.getKeyCode() == KeyEvent.VK_NUMPAD2)
        {
            camera.getVisionStructure().x -= 0.01f;
        }
        else if (e.getKeyCode() == KeyEvent.VK_NUMPAD7)
        {
            camera.getVisionStructure().y += 0.01f;
        }
        else if (e.getKeyCode() == KeyEvent.VK_NUMPAD1)
        {
            camera.getVisionStructure().y -= 0.01f;
        }
        else if (e.getKeyCode() == KeyEvent.VK_NUMPAD9)
        {
            camera.getVisionStructure().w += 1;
        }
        else if (e.getKeyCode() == KeyEvent.VK_NUMPAD3)
        {
            camera.getVisionStructure().w -= 1;
        }
    }

    /**
     */
    public void keyTyped(KeyEvent e)
    {

    }

    /**
     */
    public void keyReleased(KeyEvent e)
    {

    }
}
